﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Win32;
using System.IO;

namespace WPF_Databases
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object obj, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Image files|*.png;*.jpeg;*.jpg;*.bmp;";
            bool? result = dialog.ShowDialog();

            if (result == true)
            {
                string fileName = dialog.FileName;

                FileInfo fileInfo = new FileInfo(fileName);
                if (fileName.Length <= 1024 * 1024 * 10)
                {
                    FileStream fs = new FileStream(fileName, FileMode.Open);
                    using (fs)
                    {
                        byte[] arr = new byte[fs.Length];
                        fs.Read(arr, 0, (int)fs.Length);
                    }
                }
            }
        }
    }
}
